package com.kaikeba.bean;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;

public class User implements Serializable {
    private int id;
    private String userName;
    private String userPhone;
    private String identityNumber;
    private String password;
    private Timestamp registerTime;
    private Timestamp loginTime;
    private boolean user;

    public boolean isUser() {
        return user;
    }

    public void setUser(boolean isuser) {
        this.user = isuser;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", identityNumber='" + identityNumber + '\'' +
                ", password='" + password + '\'' +
                ", registerTime=" + registerTime +
                ", loginTime=" + loginTime +
                ", isuser=" + user +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return id == user.id &&
                Objects.equals(userName, user.userName) &&
                Objects.equals(userPhone, user.userPhone) &&
                Objects.equals(identityNumber, user.identityNumber) &&
                Objects.equals(password, user.password) &&
                Objects.equals(registerTime, user.registerTime) &&
                Objects.equals(loginTime, user.loginTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userName, userPhone, identityNumber, password, registerTime, loginTime);
    }

    public User(int id, String userName, String userPhone, String password, Timestamp registerTime, Timestamp loginTime) {
        this.id = id;
        this.userName = userName;
        this.userPhone = userPhone;
        this.password = password;
        this.registerTime = registerTime;
        this.loginTime = loginTime;
    }

    public User(String userName, String userPhone, String identityNumber, String password) {
        this.userName = userName;
        this.userPhone = userPhone;
        this.identityNumber = identityNumber;
        this.password = password;
    }

    public User(int id, String userName, String userPhone, String identityNumber, String password, Timestamp registerTime, Timestamp loginTime) {
        this.id = id;
        this.userName = userName;
        this.userPhone = userPhone;
        this.identityNumber = identityNumber;
        this.password = password;
        this.registerTime = registerTime;
        this.loginTime = loginTime;
    }

    public User() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getIdentityNumber() {
        return identityNumber;
    }

    public void setIdentityNumber(String identityNumber) {
        this.identityNumber = identityNumber;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Timestamp getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Timestamp registerTime) {
        this.registerTime = registerTime;
    }

    public Timestamp getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Timestamp loginTime) {
        this.loginTime = loginTime;
    }
}
